define(function(require, export)
{
    var CANVAS = {};

    var Canvas = export.Canvas = function()
    {
        this.context = null;
        this.width = 0;
        this.height = 0;
        this.offset = [0, 0];
    }

    Canvas.prototype.drawRect = function(rect)
    {
        this.context.fillRect(rect[0], rect[1], rect[2], rect[3]);
    }

    export.get = function(canvasID)
    {
        if(CANVAS[canvasID] == undefined)
        {
            var newCanvas = new Canvas

            var item = document.getElementById(canvasID);
            if(!item)
            {
                console.log("CanvasID %s is not valid.", canvasID);
                return null;
            }

            newCanvas.width = item.clientWidth;
            newCanvas.height = item.clientHeight;
            newCanvas.offset[0] = item.getBoundingClientRect.left;
            newCanvas.offset[1] = item.getBoundingClientRect.top;
            newCanvas.context = item.getContext('2d');

            CANVAS[canvasID] = newCanvas;
        }

        return CANVAS[canvasID];
    }

});